attrs vs data classes
#attrs #dataclasses
https://github.com/python-attrs/attrs#data-classes
indeed, dataclasses are a descendant of attrs
descendant=後継種
(積ん読)import attrs
attrsにだけできることを列挙
define special handling of NumPy arrays for equality checks
https://www.attrs.org/en/stable/why.html#data-classes
They are the result of the Python community’s wish to have an easier way to write classes in the standard library that doesn’t carry the problems of namedtuples.
wish = JavaScript-Style Object Creation in Python (using a constructor function instead of a class to create objects)
「データクラスは、標準ライブラリでcollections.namedtupleの問題を持ち込まずにクラスを書く、より簡単な方法を持ちたいというPythonコミュニティの願いの結果である」
it’s a fine library and if it stops you from abusing namedtuples, they are a huge win.
「dataclassesは素晴らしいライブラリで、namedtupleの乱用を止めるならばデータクラスの勝利だ」
感想:dataclassesはnamedtupleの問題を解消したかったのか
Nevertheless, there are still reasons to prefer attrs over Data Classes.